import serivce from '@/utils/request.js'
import { uploadRequest } from '@/utils/request.js'

export function loginApi(data) {
  return serivce({
    url: '/login',
    method: 'post',
    data
  })
}

/**
 * @获取用户信息
 */
export function getUserInfo(data) {
  return serivce({
    url: '/user/info',
    method: 'post',
    data
  })
}

/**
 * @更新用户信息
 */
export function updateUserInfo(data) {
  return serivce({
    url: '/user/updateUserInfo',
    method: 'post',
    data
  })
}

/**
 * @修改用户头像
 */
export function updateUserAvatar(data) {
  return uploadRequest({
    url: '/user/updateIcon',
    method: 'post',
    data
  })
}

/**
 * @修改密碼
 */
export function updateUserPasswordApi(data) {
  return serivce({
    url: '/user/updateUserPassword',
    method: 'post',
    data
  })
}

/**
 * @绑定邮箱
 */
export function bindEmail(data) {
  return serivce({
    url: '/user/bindEmail',
    method: 'post',
    data
  })
}